﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;

namespace Utility
{
    public class SQLServerParameterDic : IEnumerable<KeyValuePair<string, SQLServerParameterList>>, IEnumerable
    {
        private List<KeyValuePair<string, SQLServerParameterList>> items;

        public SQLServerParameterDic()
        {
            items = new List<KeyValuePair<string, SQLServerParameterList>>();
        }

        public void Add(string sql, SQLServerParameterList parameterList)
        {
            items.Add(new KeyValuePair<string, SQLServerParameterList>(sql, parameterList));
        }

        public void Clear()
        {
            items.Clear();
        }

        public int Count
        {
            get { return items.Count; }
        }

        public KeyValuePair<string, SQLServerParameterList> this[int index]
        {
            get { return items[index]; }
            set { items[index] = value; }
        }

        public void Insert(int index, string sql, SQLServerParameterList parameterList)
        {
            items.Insert(index, new KeyValuePair<string, SQLServerParameterList>(sql, parameterList));
        }

        public void RemoveAt(int index)
        {
            items.RemoveAt(index);
        }

        public IEnumerator<KeyValuePair<string, SQLServerParameterList>> GetEnumerator()
        {
            return items.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}
